$(function () {
    $('#sideMenuMainAccount').removeClass('active-menu');
	$('#sideMenuShiyongAccount').addClass("active-menu");
	$('.shiyong-day').dblclick(function(){
		//$(this).addClass('hidden');
		var shiYong = $(this);
		var value = shiYong.text();
		var adminId = shiYong.attr('data-value');
		$(this).data('date',value);
		$(this).data('adminId',adminId);
		$(this).html("<input type='text' id='requestEditEndtime'/>");	
		$(this).children().val(value);
		$('#requestEditEndtime').datepicker({
	        format: 'yyyy-mm-dd',
	        language: "zh-CN",
	        autoclose: true,
	    }).on('changeDate',function(ev){
            var value = $(this).val();
			var params = {};
			params.endtime = value;
			params.adminId = adminId;
			$.post('/Home/Account/setEndtime', params, function(data){
				var info = data.data;
				shiYong.html(info.endtime);
			});
        }).on('hide', function(event) {
            var value = $(this).val();
            shiYong.html(value);    
        });
		$(this).children().focus();
	});
	$('.shiyongPass').click(function(){
		$('#requestPass').data('adminId',$(this).attr('data-value'));
	});
	$('#requestPass').click(function(){
		var params = {};
		params.adminId = $(this).data('adminId');
		$.post('/Home/Account/setActive', params, function(data){
			$('#passModel').modal('hide');
			location.reload();
		});
	});
	$("#requestConfuse").on('click', function (e) {
		var id = $(this).attr('data-value');
		e.preventDefault();
		if (id == '') {
			tooltipWrong($(this), '客栈申请记录不存在', 1);
			return false;
		}
		var params = new Object();
		params.id = id;
		ajaxRequest('/Home/Account/setStatus', params, 'post', successUpdateCallback, errorUpdateCallback);
	});
});

